<template>
  <a-form ref="formRef" :model="formData.data" :label-col="labelCol">
    <a-row>
      <a-col :span="12">
        <a-form-item :label="t('school-manage.label.school1')">
          <a-select v-model:value="formData.data.schProjectType" mode="multiple" placeholder="请选择">
            <a-select-option v-for="item in dictLists.data[dictEnum.PRO_TYPE]"
                             :value="item.value"
                             :key="item.value"
            >
              {{ item.label }}
            </a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item :label="t('school-manage.label.school2')">
          <a-textarea
            v-model:value="formData.data.schProjectTypeBranck"
            placeholder="请输入"
            :rows="{ minRows: 1, maxRows: 6 }"
          />
        </a-form-item>
      </a-col>
      <a-col :span="24">
        <a-form-item :label="t('school-manage.label.school3')" :label-col="{ span: 3 }">
          <a-textarea
            v-model:value="formData.data.schCreditTransferPolicy"
            placeholder="请输入"
            :rows="{ minRows: 1, maxRows: 6 }"
          />
        </a-form-item>
      </a-col>
      <a-col :span="24">
        <a-form-item :label="t('school-manage.label.school4')" :label-col="{ span: 3 }">
          <a-input v-model:value="formData.data.schPerformanceRequirements" placeholder="请输入"/>
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item :label="t('school-manage.label.school5')">
          <a-select v-model:value="formData.data.isGpa" placeholder="请选择">
            <a-select-option v-for="item in dictLists.data[dictEnum.YES_OR_NO]"
                             :value="item.value"
                             :key="item.value"
            >
              {{ item.label }}
            </a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item :label="t('school-manage.label.school6')">
          <a-textarea
            v-model:value="formData.data.schGpaRequirements"
            placeholder="请输入"
            :rows="{ minRows: 1, maxRows: 6 }"
          />
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item :label="t('school-manage.label.school7')">
          <a-textarea
            v-model:value="formData.data.schXkAttention"
            placeholder="请输入"
            :rows="{ minRows: 1, maxRows: 6 }"
          />
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item
          :label="t('school-manage.label.school8')"
        >
          <a-textarea
            v-model:value="formData.data.schKcLink"
            placeholder="请输入"
            :rows="{ min: 1, max: 3}"
          />
        </a-form-item>
      </a-col>
      <a-col :span="24">
        <a-form-item :label="t('school-manage.label.school9')" :label-col="{ span: 3 }">
          <a-textarea
            v-model:value="formData.data.schRzlc"
            placeholder="请输入"
            :rows="{ minRows: 1, maxRows: 6 }"
          />
        </a-form-item>
      </a-col>
      <a-col :span="24">
        <a-form-item :label="t('school-manage.label.school10')" :label-col="{ span: 3 }">
          <a-textarea
            v-model:value="formData.data.schEndTime"
            placeholder="请输入"
            :rows="{ min: 1, max: 3}"
          />
        </a-form-item>
      </a-col>
      <a-col :span="24">
        <a-form-item :label="t('school-manage.label.school12')" :label-col="{ span: 3 }">
          <a-textarea
            v-model:value="formData.data.schKhAttention"
            placeholder="请输入"
            :rows="{ minRows: 1, maxRows: 6 }"
          />
        </a-form-item>
      </a-col>
      <a-col :span="24">
        <a-form-item :label="t('school-manage.label.school13')" :label-col="{ span: 3 }">
          <a-textarea
            v-model:value="formData.data.biYaoQi"
            placeholder="请输入"
            :rows="{ minRows: 1, maxRows: 6 }"
          />
        </a-form-item>
      </a-col>
      <a-col :span="24">
        <a-form-item :label="t('school-manage.label.school14')" :label-col="{ span: 3 }">
          <a-textarea
            v-model:value="formData.data.schRemarks"
            placeholder="请输入"
            :rows="{ minRows: 1, maxRows: 6 }"
          />
        </a-form-item>
      </a-col>
    </a-row>
  </a-form>
</template>

<script setup>
import { defineExpose, reactive, ref, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { getDictByCodesReturnObj } from "@/tools/get-dict"
import dictEnum from "@/const/dict"

const { t } = useI18n()
const labelCol = { span: 6 }
const formRef = ref()
const formData = reactive({
  data: {}
})

const submit = () => {
  return new Promise(resolve => {
    formRef.value.validate().then(() => {
      resolve({ modelForm: formData.data });
    }).catch(err => {
      resolve({...err, modelForm: formData.data })
    });
  });
};

const dictLists = reactive({
  data: {},
  code: [dictEnum.PRO_TYPE, dictEnum.YES_OR_NO],
  countryData: []
})

onMounted(async () => {
  dictLists.data = await getDictByCodesReturnObj(dictLists.code)
})

const updateFormData = data => {
  formData.data = data
}

defineExpose({
  submit,
  updateFormData
})
</script>

<style scoped>

</style>
